//
//  DatePickerController.swift
//  HHSwift
//
//  Created by 华宏 on 2020/2/4.
//  Copyright © 2020 huahong. All rights reserved.
//

import UIKit

class DatePickerController: UIViewController,QKDatePickerDelegate {

    var datePicker = QKDatePicker.init(defaultDate: Date(), datePickerModel: .dateAndTime)

    override func viewDidLoad() {
        super.viewDidLoad()

        view.backgroundColor = .white
        title = "DatePicker"
        
       datePicker.dateFormat = "yyy-MM-dd HH:mm:ss"
       datePicker.minimumDate = Date().dateByAddingDays(days: -3)!
       datePicker.maximumDate = Date().dateByAddingDays(days: 3)!
       datePicker.delegate = self
              
       datePicker.sureBtnBlock = {(date,text) in
            print("Block selectDate :\(text)")
        }

    }
    

    func pickerView(_ pickerView: QKDatePicker, didSelectDate selectDate: Date, selectText text: String) {
              
           print("Delegate selectDate :\(text)")
        }

     override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
                        
            datePicker.show()
            
        }
}
